<template>
  <div class="node">
    <span class="text">
      <slot></slot>
    </span>
    <span class="add" @click="$emit('add', item)"></span>
    <span v-if="!isRoot" class="modify" @click="$emit('modify', item)"></span>
    <span v-if="!isRoot" class="delete" @click="$emit('delete', item)"></span>
  </div>
</template>
<script>

export default {
  name: 'Node',
  props: {
    item: Object,
    isRoot: Boolean,
  },
};
</script>
<style lang="less">
@import url(../../../static/style/site.comm.less);
@import url(../../../static/style/site.vars.less);

.node {
  margin-top: 5px;
  user-select: none;
  display: flex;
  justify-content: left;
  align-items: center;
  .text {
    padding: 10px;
    margin-right: 20px;
  }
  .add, .modify, .delete {
    width: 30px;
    height: 30px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 2px;
    padding-right: 1px;
    border-radius: 15px;
    box-sizing: border-box;
    // color: #fff;
    // background: @site-main;
    cursor: pointer;
    margin: 0 5px 0 5px;
    border: .5px @site-main solid;
  }
  .add {
    background: url(../../assets/img/u532.png) center center no-repeat;
    transform: rotate(45deg);
    &:hover {
      background: url(../../assets/img/u532_mouseOver.png) center center no-repeat;
    }
  }
  .modify {
    background: url(../../assets/img/check_grey.png) center center no-repeat;
    &:hover {
      background: url(../../assets/img/check_blue.png) center center no-repeat;
    }
  }
  .delete {
    background: url(../../assets/img/u532.png) center center no-repeat;
    &:hover {
      background: url(../../assets/img/u532_mouseOver.png) center center no-repeat;
    }
  }
}
</style>
